﻿/**
 * ...
 * @author George Mavchun
 */

package gui.hug.priv;

import flash.display.Shape;
import flash.display.Sprite;
import flash.text.TextFormat;
import gui.hug.HUGLabel;
import gui.hug.HUGColors;
import gui.hug.HUGSprite;

class HUGComboBoxButtonDisplayState extends HUGSprite
{
	public function new(text : String, width : Float, bgColor : Int) 
	{
		super();
		this.width = width;
		addImage(text, bgColor);
	}

	private function addImage(text : String, bgColor : Int) {
		var shape = new Shape();
		
		shape.graphics.lineStyle(1, HUGColors.VK_BORDER_OUTER);
		shape.graphics.beginFill(HUGColors.WHITE);
        shape.graphics.drawRect(0, 0, width, 20);
        shape.graphics.endFill();
		
		shape.graphics.lineStyle(1, HUGColors.WHITE);
		shape.graphics.beginFill(bgColor);
		shape.graphics.drawRect(width - 20, 1, 19, 18);
		shape.graphics.endFill();
		
		shape.graphics.lineStyle(1, 0x000000);
		for (i in 4...11) {
			shape.graphics.moveTo(width - 20 + i, i + 4);
			shape.graphics.lineTo(width - i, i + 4);
		}		
		addChild(shape);
		
		var label : HUGLabel = new HUGLabel();
		label.text = text;
		label.setTextFormat(new TextFormat("Arial", 12));
		addChild(label);
	}
	
}